package com.lee.dutylower.domain;

/**
 * Created by lijie on 2017/5/2.
 */

public enum SoldierCharacter {
    MONITOR("班长",1), SOLDIER("士兵",0);
    private String name;
    private int code;
    SoldierCharacter(String name, int code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public static int getCodeByName(String name){
        int c = -1;
        switch (name){
            case "班长":
                c = MONITOR.code;
                break;
            case "士兵":
                c = SOLDIER.code;
                break;

        }
        return c;
    }

    public static String getNameByCode(int code){
        String n = null;
        switch (code){
            case 1:
                n = MONITOR.name;
                break;
            case 0:
                n = SOLDIER.name;
                break;

        }
        return n;
    }
}
